<?php
require_once './class/timex/view/class.TimexStandard.php';

class Timex {
	protected $objView = NULL;
	protected $timeStamp = 0;

	function __construct($timeStamp) {
		$this->objView = new TimexStandard();
		$this->timeStamp = $timeStamp;
	}
	
	function __destruct() {

	}

	public function setObjView($objView) {
		$this->objView = $objView;
	}

	public function getTime() {
		$tstampArray = getdate($this->timeStamp);
		$time['year'] = $tstampArray['year'];
		$time['day']['digits'] = (strlen($tstampArray['mday']) == 1)? '0'.$tstampArray['mday'] : $tstampArray['mday'];
		$time['day']['week'] = $this->objView->getWeekDay($tstampArray['wday']);
		$time['month']['digits'] = (strlen($tstampArray['mon']) == 1)? '0'.$tstampArray['mon'] : $tstampArray['mon'];
		$time['month']['short'] = $this->objView->getMonthShort($tstampArray['mon']);
		$time['month']['full'] = $this->objView->getMonthFull($tstampArray['mon']);
		$time['hour'] = (strlen($tstampArray['hours']) == 1)? '0'.$tstampArray['hours'] : $tstampArray['hours'];
		$time['minute'] = (strlen($tstampArray['minutes']) == 1)? '0'.$tstampArray['minutes'] : $tstampArray['minutes'];
		$time['secund'] = (strlen($tstampArray['seconds']) == 1)? '0'.$tstampArray['seconds'] : $tstampArray['seconds'];
		$time['raw'] = $this->timeStamp;
		$time['formatted'] = $this->objView->time($time);

		return $time;
	}	

}

?>
